Skip to content

feat: path-based scanning of urls#8662

Merged
mindofmar merged 4 commits into
mainfrom
feat/path-based-scanning-v1
May 13, 2026
Merged

feat: path-based scanning of urls#8662
mindofmar merged 4 commits into
mainfrom
feat/path-based-scanning-v1

Conversation

@mindofmar
Copy link
Copy Markdown
Contributor

@mindofmar mindofmar commented Apr 30, 2026

Explanation

Why: Dapp scanning now supports path-level dapp scanning. Without this client-side change, the API never receives paths and the path-scanning capability goes unused.

References

Fixes: https://consensyssoftware.atlassian.net/jira/software/c/projects/PSAFE/boards/1950?selectedIssue=PSAFE-419
Extension PR: MetaMask/metamask-extension#42311

Screenshots

I've ran MetaMask Extension locally with these changes. Paths are now included in the API request.
image

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Modifies scanUrl request/caching semantics to sometimes key on hostname+pathname, which can change phishing detection outcomes and cache behavior for gateway domains and could affect API load if misclassified.

Overview
Adds path-aware phishing URL scanning for shared gateway hosts. PhishingController.scanUrl now sends hostname+pathname (instead of hostname-only) for a curated set of gateway root domains and subdomains, and caches results by this scan parameter.

Introduces new utilities/constants (PHISHING_DETECTION_PATH_BASED_ROOT_DOMAINS, isPhishingDetectionPathBasedHostname, getPhishingDetectionScanUrlParam), exports them from index.ts, and updates tests/changelog to cover the new request format and per-path caching behavior.

Reviewed by Cursor Bugbot for commit 74ef4dc. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7229179. Configure here.

};

this.#urlScanCache.set(hostname, result);
this.#urlScanCache.set(scanUrlParam, result);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shared cache uses inconsistent keys across methods

Medium Severity

scanUrl now reads/writes #urlScanCache using scanUrlParam (e.g. ipfs.io/ipfs/QmAAA) as the key, but bulkScanUrls still reads/writes the same shared #urlScanCache using plain hostname (e.g. ipfs.io). Before this change both methods used hostname, so the cache was coherent. Now, for path-based gateway hosts, results cached by one method are invisible to the other, causing redundant API calls and inconsistent cache-hit behavior depending on which method was called first.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7229179. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Known limitation with this PR but should have minimal impact since bulk scans are only used by the NftController, therefore the overlap in scans should be low.

We can address this in a follow-up PR

@mindofmar mindofmar requested a review from a team as a code owner May 1, 2026 14:07
@mindofmar mindofmar added this pull request to the merge queue May 13, 2026
Merged via the queue into main with commit 0ff0c06 May 13, 2026
370 checks passed
@mindofmar mindofmar deleted the feat/path-based-scanning-v1 branch May 13, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants